﻿<local:MyWindow x:Class="MercuryFE.PopupMenu"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:local="clr-namespace:MercuryFE"
                WindowStyle="None" Background="LightGray" ShowInTaskbar="False"
                WindowStartupLocation="CenterOwner"
        Title="PopupMenu" Height="300" Width="300">
    <Window.Resources>

        <local:FontSizeConverter x:Key="fontSizeConverter" />
        <DataTemplate x:Key="ListBoxItemTemplate">
            <TextBlock Text="{Binding}" Grid.Column="0" Grid.Row="0" Margin="1">
                    <TextBlock.Effect>
                            <DropShadowEffect Color="Black" BlurRadius="10"/>
                    </TextBlock.Effect>
            </TextBlock>
        </DataTemplate>

        <Style TargetType="{x:Type ListBoxItem}">
            <Setter Property="Foreground">
                <Setter.Value>Black</Setter.Value>
            </Setter>

            <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBox}}, Path=ActualHeight, Converter={StaticResource fontSizeConverter}, ConverterParameter=15}" />
            <Style.Triggers>
                <Trigger Property="IsSelected" Value="True">
                    <Setter Property="Foreground" Value="Yellow"/>
                   
                </Trigger>
            </Style.Triggers>

            <Style.Resources>
                <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/>

                <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent"/>

            </Style.Resources>
        </Style>
    </Window.Resources>
    <Grid>
        <ListBox x:Name="lbMenu" Grid.Row="1" Grid.ColumnSpan="3" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
                 ScrollViewer.VerticalScrollBarVisibility="Hidden" Background="Transparent" BorderBrush="Transparent" ItemTemplate="{StaticResource ListBoxItemTemplate}" />
    </Grid>
</local:MyWindow>
